import { createRouter, createWebHistory } from 'vue-router';

const Layout = () => import('@/views/Layout/index.vue')
const Home = () => import('@/views/Home/index.vue')
const AllFlower=()=>import('@/views/Flower/index.vue')
const Detail=()=>import('@/views/Detail/index.vue')
const Cart=()=>import('@/views/Cart/index.vue')
const Checkout=()=>import('@/views/Checkout/index.vue')
const Login=()=>import('@/views/Login/index.vue')

const Orders=()=>import('@/views/Orders/index.vue')

const routes = [
    {
        path: '/',
        component: Layout,
        children: [
            {
                path: '/',
                component: Home
            },
            {
                path: '/allflower',
                component: AllFlower
            },
            {
                path: '/detail/:flowerId',
                component: Detail
            },
            {
                path: '/cart',
                component: Cart
            },
            {
                path: '/checkout',
                component: Checkout
            },
            {
                path: '/orders',
                component: Orders
            }
        ]
    },
    {
      path: '/login',
      component: Login
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes: routes,
    scrollBehavior(to, from, savedPosition) {
        return { top: 0 };
    }
});

export default router;
